@model IEnumerable<University.Models.Department>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            NameRomanian
        </th>
        <th>
            NameRussian
        </th>
        <th>
            NameOther
        </th>
        <th>
            YearFounded
        </th>
        <th>
            SeniorProfessor
        </th>
        <th>
            Description
        </th>
        <th>
            Faculty
        </th>
        <th>
            Domains
        </th>
        <th>
            Documents
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.DepartmentId }) |
            @Html.ActionLink("Details", "Details", new { id=item.DepartmentId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.DepartmentId })
        </td>
        <td>
			@item.NameRomanian
        </td>
        <td>
			@item.NameRussian
        </td>
        <td>
			@item.NameOther
        </td>
        <td>
			@String.Format("{0:g}", item.YearFounded)
        </td>
        <td>
			@(item.SeniorProfessor == null ? "None" : item.SeniorProfessor.LastName)
        </td>
        <td>
			@item.Description
        </td>
        <td>
			@(item.Faculty == null ? "None" : item.Faculty.Name)
        </td>
        <td>
			@(item.Domains == null ? "None" : item.Domains.Count.ToString())
        </td>
        <td>
			@(item.Documents == null ? "None" : item.Documents.Count.ToString())
        </td>
    </tr>
}

</table>


